Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: failed to remove policy from non-filled casbin model. #1

Closed
wants to merge 1 commit into from
Closed

Conversation

DarcJC
Copy link

@DarcJC DarcJC commented Aug 2, 2021

If someone using model like the RBAC model that not fill 6 slot(v0-v5), while adding the policy to the database(I'm testing with postgresql) the empty slot will be treat as NULL.
In adapter.py#L63 and adapter.py#L73 are constructing the query with ""(empty string) but None(NULL). It will never match any records in this situation, so policies will never be deleted(But casbin will delete them from its in-memory model which will break the consistency.)

model e.g.

_model = """
[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act, eft

[role_definition]
g = _, _

[policy_effect]
e = some(where (p.eft == allow)) && !some(where (p.eft == deny))

[matchers]
m = g(r.sub, p.sub) && keyMatch(r.obj, p.obj) && keyMatch(r.act, p.act)
"""

@hsluoyz
Copy link

hsluoyz commented Aug 3, 2021

@thearchitector

@thearchitector
Copy link
Owner

thearchitector commented Aug 4, 2021

@hsluoyz @DarcJC Thanks for bringing this to my attention! Closing in favor of 58444d9, to fix the type check.

@thearchitector thearchitector added bug Something isn't working fixed triaged labels Aug 4, 2021
@thearchitector thearchitector self-requested a review August 4, 2021 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants